<?php
/**
 * 数据操作类
 */
class Data{
	
	public $oldData;
	public function __construct($url)
	{
		$data = file_get_contents($url);
		$this->oldData = json_decode($data,true);
	}

	public function add($data)
	{
		$this->oldData[] = $data;
		$this->save();
	}

	public function del($value='')
	{
		# code...
	}

	public function update($value='')
	{
		# code...
	}

	public function select($value='')
	{
		return $this->oldData;
	}

	public function save()
	{
		$str = json_encode($this->oldData);

		file_put_contents('./db.txt', $str);
	}

	public function __destruct()
	{
		echo 9999;
	}
}